﻿Type.registerNamespace("AjaxControlToolkit.TextEditor");

AjaxControlToolkit.TextEditor.HtmlEditor = function(element) {
	AjaxControlToolkit.TextEditor.HtmlEditor.initializeBase(this, [element]);
	this._txtEditorID = '';
	this._lblEdID = '';
	this._imgbtnEdID = '';
	this._hoverImageUrl = '';
	this._outImageUrl = '';
}

AjaxControlToolkit.TextEditor.HtmlEditor.prototype =
{
	get_hoverImageUrl: function() {
		return this._hoverImageUrl;
	},

	set_hoverImageUrl: function(value) {
		this._hoverImageUrl = value;
	},

	get_outImageUrl: function() {
		return this._outImageUrl;
	},

	set_outImageUrl: function(value) {
		this._outImageUrl = value;
	},

	get_txtEditorID: function() {
		return this._txtEditorID;
	},

	set_txtEditorID: function(value) {
		this._txtEditorID = value;
	},

	get_lblEdID: function() {
		return this._lblEdID;
	},

	set_lblEdID: function(value) {
		this._lblEdID = value;
	},

	get_imgbtnEdID: function() {
		return this._imgbtnEdID;
	},

	set_imgbtnEdID: function(value) {
		this._imgbtnEdID = value;
	},

	initialize: function() {
		
		var f = $get(this._txtEditorID);
		f.style.backgroundColor = "#cccccc";

		$addHandler(f, 'click',
        Function.createDelegate(this, this._onClick));

		$addHandler(f, 'mouseover',
        Function.createDelegate(this, this._onMouseOver));

		$addHandler(f, 'mouseout',
        Function.createDelegate(this, this._onMouseOut));

		var g = $get(this._imgbtnEdID);

		$addHandler(g, 'mouseover',
        Function.createDelegate(this, this._onMouseOverIMG));

		$addHandler(g, 'mouseout',
        Function.createDelegate(this, this._onMouseOutIMG));
	},

	_onClick: function() {
		alert("Test!");
	},

	_onMouseOver: function() {
		var e = $get(this._txtEditorID);
		var f = $get(this._lblEdID);
		e.style.backgroundColor = "";
		f.style.display = "block";
	},

	_onMouseOut: function() {
		var e = $get(this._txtEditorID);
		var f = $get(this._lblEdID);
		e.style.backgroundColor = "";
		f.style.display = "none";
	},

	_onMouseOverIMG: function() {
		var e = $get(this._imgbtnEdID);
		e.src = this._hoverImageUrl;
	},

	_onMouseOutIMG: function() {
		var e = $get(this._imgbtnEdID);
		e.src = this._outImageUrl;
	},

	dispose: function() {

		AjaxControlToolkit.TextEditor.HtmlEditor.callBaseMethod(this, 'dispose');
	},

	add_modifiedChanged: function(handler) {
		this.get_events().addHandler('modifiedChanged', handler);
	},

	InitializeEventHandlers: function() {

	},

	ClearEventHandlers: function() {

	}
}

AjaxControlToolkit.TextEditor.HtmlEditor.descriptor =
{
	properties: [
					{ name: 'txtEditorID', type: String },
					{ name: 'lblEdID', type: String },
					{ name: 'imgbtnEdID', type: String },
					{ name: 'hoverImageUrl', type: String },
					{ name: 'outImageUrl', type: String }
                ]
}

AjaxControlToolkit.TextEditor.HtmlEditor.registerClass("AjaxControlToolkit.TextEditor.HtmlEditor", Sys.UI.Control);
